clear
set more off
log using "\\file\UsersW$\wrr15\Home\My Documents\My Files\ATANDA AKINWANDE\BCD PAPER\HEALTH ECONOMICS revision\NEW DATA AND PROGRAMS (20171021)\TABLE1.smcl", replace
use "\\file\UsersW$\wrr15\Home\My Documents\My Files\ATANDA AKINWANDE\BCD PAPER\HEALTH ECONOMICS revision\NEW DATA AND PROGRAMS (20171021)\BCD_dataset_09_11_2017", clear

//ge phpnh = 100*phn
//ge lhl = 100*lhsl

summ phpnh lhl prod k pop14 pop65 male lex infmo tobaco alcohc gdpg

gsort phpnh
list phpnh country year in 1/10
gsort -phpnh
list phpnh country year in 1/10

gsort lhl
list lhl country year in 1/10
gsort -lhl
list lhl country year in 1/10

gsort prod
list prod country year in 1/10
gsort -prod
list prod country year in 1/10

gsort k
list k country year in 1/10
gsort -k
list k country year in 1/10

gsort pop65
list pop65 country year in 1/10
gsort -pop65
list pop65 country year in 1/10

gsort lex
list lex country year in 1/10
gsort -lex
list lex country year in 1/10

gsort infmo
list infmo country year in 1/10
gsort -infmo
list infmo country year in 1/10

gsort tobaco
list tobaco country year in 1/10
gsort -tobaco
list tobaco country year in 1/10

gsort alcohc
list alcohc country year in 1/10
gsort -alcohc
list alcohc country year in 1/10

foreach v of varlist (lhl phpnh prod k pop14 pop65 male lex infmo tobaco alcohc gdpg) {
bysort cid: egen avg_`v' = mean(`v')
gen dm`v' = `v' - avg_`v'
drop avg_`v'
}

summarize dmphpnh dmlhl dmprod dmk dmpop14 dmpop65 dmmale dmlex dminfmo dmtobaco dmalcohc dmgdpg

log close
